#include "core.h"
#include "BTBase.h"
#include "BehaviorTree/BehaviorTree.h"
#include "BehaviorTree/BTBlackBoard.h"

CBTBase::CBTBase()
: m_pBT(NULL)
{

}

CBTBase::~CBTBase()
{
	DestroyBT();
}

void CBTBase::DestroyBT()
{
	if (m_pBT)
	{
		delete m_pBT;
		m_pBT = NULL;
	}
}

void CBTBase::CreateBT(std::string strXML, xObjBase* self)
{
	DestroyBT();

	m_pBT = new CBehaviorTree;
	m_pBT->getBTBlackBoard()->setSelf( self );
	m_pBT->loadBT( strXML );
	m_pBT->getBTBlackBoard()->clean();
}
